using System;
using System.Collections.Generic;
using System.Text;
using Refly.CodeDom;
using Refly.CodeDom.Statements;
using Refly.CodeDom.Expressions;

namespace Doubler.Templates.Recorder.RecorderActions
{
    public class ReturnValue : RecorderActionBase
    {
        protected override void doAct(Refly.CodeDom.IClassDeclaration recorder, Refly.CodeDom.MethodDeclaration recorderMethod, Refly.CodeDom.Expressions.NativePropertyReferenceExpression recordingProperty, Reflector.CodeModel.ITypeReference subject, Reflector.CodeModel.IMethodDeclaration methodInformation)
        {
            if (methodInformation.ReturnType.Type.ToString() != "Void" && methodInformation.ReturnType.Type.ToString() != "System.Void")
            {
                Statement ReturnStatement = Stm.Return(recordingProperty.Prop(RecorderGenerator.RecordingReturnValue));
                recorderMethod.Body.Add(ReturnStatement);
            }
        }
    }
}
